/**
 * Redux Store 配置文件
 * 使用 Redux Toolkit 配置全局状态管理
 * 整合所有 reducers 并导出类型定义
 */

import { configureStore } from '@reduxjs/toolkit';
import authReducer from './slices/authSlice.ts';
import searchReducer from './slices/searchSlice.ts';
import momentsReducer from './slices/momentsSlice.ts';
import carouselReducer from './slices/carouselSlice.ts';

/**
 * 配置 Redux Store
 * 整合所有 reducers：
 * - auth: 用户认证相关状态
 * - search: 搜索功能相关状态
 * - moments: 病友圈相关状态
 * - carousel: 轮播图相关状态
 */
export const store = configureStore({
    reducer: {
        auth: authReducer,
        search: searchReducer,
        moments: momentsReducer,
        carousel: carouselReducer,
    },
});

/**
 * 类型定义
 * RootState: 整个 Redux store 的状态类型
 * AppDispatch: Redux dispatch 函数的类型
 */
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;


